libxc: osdep: convert xc_evtchn_fd()
authorIan Campbell <ian.campbell@citrix.com>
Fri, 3 Dec 2010 09:36:47 +0000 (09:36 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 3 Dec 2010 09:36:47 +0000 (09:36 +0000)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
tools/libxc/xc_evtchn.c
tools/libxc/xc_linux.c
tools/libxc/xc_minios.c
tools/libxc/xc_netbsd.c
tools/libxc/xc_solaris.c
tools/libxc/xenctrlosdep.h

index 528b59305bd76d4558474f09d9f7796d68064281..899a9edae0622d6e398bfdc56fa275d44c38644f 100644 (file)
@@ -77,3 +77,8 @@ int xc_evtchn_status(xc_interface *xch, xc_evtchn_status_t *status)
     return do_evtchn_op(xch, EVTCHNOP_status, status,
                         sizeof(*status), 1);
 }
+
+int xc_evtchn_fd(xc_evtchn *xce)
+{
+    return xce->ops->u.evtchn.fd(xce, xce->ops_handle);
+}
index d247c9c19391d214e22c949032763a2a1757ed05..d6956ccc85598a7024d4ec963e56bedf77431656 100644 (file)
@@ -360,9 +360,9 @@ static int linux_evtchn_close(xc_evtchn *xce, xc_osdep_handle h)
     return close(fd);
 }
 
-int xc_evtchn_fd(xc_evtchn *xce)
+static int linux_evtchn_fd(xc_evtchn *xce, xc_osdep_handle h)
 {
-    return xce->fd;
+    return (int)h;
 }
 
 int xc_evtchn_notify(xc_evtchn *xce, evtchn_port_t port)
@@ -434,6 +434,10 @@ int xc_evtchn_unmask(xc_evtchn *xce, evtchn_port_t port)
 static struct xc_osdep_ops linux_evtchn_ops = {
     .open = &linux_evtchn_open,
     .close = &linux_evtchn_close,
+
+    .u.evtchn = {
+        .fd = &linux_evtchn_fd,
+    },
 };
 
 /* Optionally flush file to disk and discard page cache */
index 942fa7b262275d468defecd0dbef8a80f26382e9..aeda6eab09012c31d880fdfedef1b734ff134c57 100644 (file)
@@ -226,9 +226,9 @@ void minios_evtchn_close_fd(int fd)
     files[fd].type = FTYPE_NONE;
 }
 
-int xc_evtchn_fd(xc_evtchn *xce)
+static int minios_evtchn_fd(xc_evtchn *xce, xc_osdep_handle h)
 {
-    return xce->fd;
+    return (int)h;
 }
 
 int xc_evtchn_notify(xc_evtchn *xce, evtchn_port_t port)
@@ -400,6 +400,10 @@ int xc_evtchn_unmask(xc_evtchn *xce, evtchn_port_t port)
 static struct xc_osdep_ops minios_evtchn_ops = {
     .open = &minios_evtchn_open,
     .close = &minios_evtchn_close,
+
+    .u.evtchn = {
+        .fd = &minios_evtchn_fd,
+    },
 };
 
 /* Optionally flush file to disk and discard page cache */
index 7c60104e4f6ccb54d7659cdebb737d28404da46a..2f632fbdb7b3e89fb680db36b1e229ae8e92ef46 100644 (file)
@@ -210,9 +210,9 @@ static int netbsd_evtchn_close(xc_evtchn *xce, xc_osdep_handle h)
     return close(fd);
 }
 
-int xc_evtchn_fd(xc_evtchn *xce)
+static int netbsd_evtchn_fd(xc_evtchn *xce, xc_osdep_handle h)
 {
-    return xce->fd;
+    return (int)h;
 }
 
 int xc_evtchn_notify(xc_evtchn *xce, evtchn_port_t port)
@@ -299,6 +299,10 @@ int xc_evtchn_unmask(xc_evtchn *xce, evtchn_port_t port)
 static struct xc_osdep_ops netbsd_evtchn_ops = {
     .open = &netbsd_evtchn_open,
     .close = &netbsd_evtchn_close,
+
+    .u.evtchn = {
+        .fd = &netbsd_evtchn_fd,
+    },
 };
 
 /* Optionally flush file to disk and discard page cache */
index 3867e8960a1b59b4e5ce04294d490bbd15f6205a..506319b7ff0f1aafa90b2a28dca0ea66eae29828 100644 (file)
@@ -202,9 +202,9 @@ static int solaris_evtchn_close(xc_evtchn *xce, xc_osdep_handle h)
     return close(fd);
 }
 
-int xc_evtchn_fd(xc_evtchn *xce)
+static int solaris_evtchn_fd(xc_evtchn *xce, xc_osdep_handle h)
 {
-    return xce->fd;
+    return (int)h;
 }
 
 int xc_evtchn_notify(xc_evtchn *xce, evtchn_port_t port)
@@ -276,6 +276,10 @@ int xc_evtchn_unmask(xc_evtchn *xce, evtchn_port_t port)
 static struct xc_osdep_ops solaris_evtchn_ops = {
     .open = &solaris_evtchn_open,
     .close = &solaris_evtchn_close,
+
+    .u.evtchn = {
+        .fd = &solaris_evtchn_fd,
+    },
 };
 
 /* Optionally flush file to disk and discard page cache */
index 5f93b7361dafd6c8a53b88cac489482b7e9ab78c..8607ad8f8027be4f2aaa3cf314a71e654a902b36 100644 (file)
@@ -74,6 +74,9 @@ struct xc_osdep_ops
                                         size_t chunksize, privcmd_mmap_entry_t entries[],
                                         int nentries);
         } privcmd;
+        struct {
+            int (*fd)(xc_evtchn *xce, xc_osdep_handle h);
+        } evtchn;
     } u;
 };
 typedef struct xc_osdep_ops xc_osdep_ops;